//
//  AppTools.m
//  礼物
//
//  Created by dllo on 15/11/4.
//  Copyright © 2015年 liangsicheng. All rights reserved.
//

#import "AppToolss.h"

@implementation AppToolss
+(void)getAFNetWorkingData:(NSString *)url andBlock:(AFNBlock)block andError:(ANFFailure)failureBlock1
{
    NSLog(@"请求数据成功");
    NSString *url_string = [NSString stringWithFormat:@"%@",url];
    //[NSSet setWithObjects:@"text/plain",@"text/json",@"application/json",@"text/javascript",@"text/html",nil];  代表支持所有的接口类型
    //请求管理者 所有的网络请求,均有manager发起
    AFHTTPRequestOperationManager* manager = [AFHTTPRequestOperationManager manager];
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"text/plain",@"text/json",@"application/json",@"text/javascript",@"text/html",nil];
    [manager GET:url_string parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) {
        block(responseObject);
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        failureBlock1(error);
        NSLog(@"请求数据失败");
    }];
}


@end
